package com.zf.rpc.loadbalancer;

import com.alibaba.nacos.api.naming.pojo.Instance;

import java.util.List;
import java.util.Random;

/**
 * @ProjectName: RPC-zhaofeng
 * @Package: com.zf.rpc.loadbalancer
 * @ClassName: RandomLoadBalancer
 * @Author: zf
 * @Description:
 * @Date: 2021/5/18 20:26
 * @Version: 1.0
 */
public class RandomLoadBalancer implements LoadBalancer{
    @Override
    public Instance select(List<Instance> instances) {
        return instances.get(new Random().nextInt(instances.size()));
    }
}
